package com.clock.controller.stage;


import com.clock.common.domain.R;
import com.clock.domain.dto.FollowStateDTO;
import com.clock.service.FollowService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(tags = {"前台-关注"})
@RestController
@RequestMapping("/follow")
public class FollowController {

    @Resource
    FollowService followService;


    @PostMapping("/state")
    @ApiOperation(value = "关注/取关操作",notes = "首次关注或更新关注状态操作")
    public R updateFollow(@RequestBody FollowStateDTO followStateDto) throws Exception {

        return followService.updateFollowState(followStateDto);
    }

    @GetMapping("/myfollows/{userId}/{pageNum}/{pageSize}")
    @ApiOperation(value = "查询关注好友列表", notes = "查看好友列表")
    public R queryFollows(@PathVariable Long userId, @PathVariable("pageNum") Integer pageNum, @PathVariable("pageSize") Integer pageSize) throws Exception {

        return followService.showFollows(userId, pageNum, pageSize);
    }

    @GetMapping("/myfans/{userId}/{pageNum}/{pageSize}")
    @ApiOperation(value = "查询粉丝列表", notes = "查询粉丝列表")
    public R queryFans(@PathVariable Long userId, @PathVariable("pageNum") Integer pageNum , @PathVariable("pageSize") Integer pageSize) throws Exception {

        return followService.getFans(userId, pageNum, pageSize);
    }


}
